﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HammerMUD.System;

namespace HammerMUD.Commands
{
    public class WhoCommand : Command
    {
        public WhoCommand()
        {
            SecurityLevel = HammerMUD.Admin.SecurityLevel.User;
            Name = "who";
            Help =  "\twho\n\r" +
                    "Shows a list of all characters currently logged into the game";
        }

        public override void Do(User from, List<String> arguments)
        {
            from.Send("Players currently connected to " + HammerMUD.System.HammerMUD.SystemInfo.MudName);
            foreach (User u in HammerMUD.System.HammerMUD.Users)
            {
                if (u.UserAccount != null && u.UserAccount.CurrentCharacter != null)
                {
                    from.Send("\t" + u.UserAccount.CurrentCharacter.Name);
                }
            }
            from.Send("");
        }
    }
}
